package com.hmdp.utils;

import java.lang.*;
import java.io.*;

public class Main1 {

    public static int n;
    public static String[] s = new String[5000010];

    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
//        n=Integer.valueOf(bufferedReader.readLine());

        File file = new File("test.txt");

        FileOutputStream fileOutputStream = new FileOutputStream(file);

        int n=0;
         for(int i=0;i<=5000000;i++){
                    s[i]=play(i);
                    s[i]="\""+s[i]+"\""+","+"\n";
                    fileOutputStream.write(s[i].getBytes());
             System.out.println(i);
             }


    }

    public static String play(int n) {
        int max = (int) Math.sqrt(n)+1;
        for(int a=0;a<=max;a++) {
            for (int b = 0; b <= max; b++) {
                int now = n - a * a - b * b;
                int nowMax = (int) Math.sqrt(now) + 1;
                for (int c = 0; c <= nowMax; c++) {
                    int d = n - a * a - b * b - c * c;
                    int temp = (int) Math.sqrt(d);
                    if (temp * temp == d) {
                       return  a + " " + b + " " + c + " " + temp;
                    }
                }
            }
        }
        return "0 0 0 0";
    }

}